/*----------------------------------------\ | Change a page to landscape; | | Note: that if you change the page to landscape, remember to change | | it back to portait after the page; otherwise, it will | | continue landscape until the end of the document; this | | function is always used with %portrait together; | |-------------------------------------------| |--------------------------------------------------------------------| |---------------------------| | Arguments: | | wordref - not necessary; default is "wordsys"; | |-----------------------------| |--------------------------------------------------------------------| |---------------------------------------| | Example: %landscape; | | %portrait; | | Usage: %landscape(wordref); | \----------------------------------------*/ %macro landscape/parmbuff; /*--------------------------------------------\ | Copy Right: Duo Zhou; | | Created: 2-7-2001 8:51pm; | | Purpose: Change the format of the pages in | | the word document to landscape; | \--------------------------------------------*/ %local arg fref wsid rc; %let arg=%qscan(&syspbuff,1,%str((),)); %let fref=; %let wsid=0; %if (%index(%quote(%upcase(%sysfunc(compress(%quote(&arg))))),%str(WORDREF=))) or (%index(%quote(%upcase(%sysfunc(compress(%quote(&arg))))),%str(WINREF=))) or (%index(%quote(%upcase(%sysfunc(compress(%quote(&arg))))),%str(WINDOW=))) or (%index(%quote(%upcase(%sysfunc(compress(%quote(&arg))))),%str(WIN=))) %then %do; %let fref=%qscan(&arg, 2, %str(= )); %put --> Note: Checking the status of window "&fref" to see if it is opened.; %end; %else %if (%quote(&arg) ne) %then %do; %if not (%index(%quote(%upcase(%sysfunc(compress(%quote(&arg))))),%str(=))) %then %do; %let fref=%sysfunc(compress(&arg)); %put --> Note: Checking the status of window "&fref" to see if it is open.; %end; %else %do; %put --> Alert! Alert! Keyword Parameter isn%str(%')t declared!; %end; %end; %else %if (%quote(&arg) eq) %then %do; %let fref=wordsys; %put --> Note: No window reference is specified%str(;) Checking the status of the default; %put -->"&fref" to see if it is open.; %end; %if (%quote(&fref) ne) %then %do; %let wsid=%sysfunc(fopen(&fref,o,132,e)); %end; %if &wsid %then %do; %let rc=%sysfunc(fclose(&wsid)); data _null_; file &fref lrecl=2000; length str $2000.; str='[FilePageSetup .Tab = "1", .PaperSize = "0", .TopMargin = "1.25" + Chr$(34), .BottomMargin = "1.25" + Chr$(34), .LeftMargin = "1" + Chr$(34), .RightMargin = "1" + Chr$(34), .Gutter = "0" + Chr$(34)]'; put str; str='[FilePageSetup .PageWidth = "11" + Chr$(34), .PageHeight = "8.5" + Chr$(34), .Orientation = 1, .FirstPage = 0, .OtherPages = 0, .VertAlign = 0, .ApplyPropsTo = 1, .FacingPages = 0]'; put str; str='[FilePageSetup .CountBy = "0", .NumMode = -1]'; put str; run; %end; %else %do; %put ==> Alert! Incorrect window reference "&fref", or window "&fref" isn%str(%')t open.; %end; %mend landscape;